<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../js/css/nav.css">
    <title>父子组件</title>
</head>

<body>
    <div id="app">
        这是内容区域
        <my-footer></my-footer>
    </div>
    <template id="footer">
        <div  class="bottom-navbar">
            这是父组件内容
            <footer-item :name="item.title" v-for="(item, index) in items" :key="index"></footer-item>
        </div>

    </template>
    <template id="footerItem">
        <div>
            <a>{{name}}</a>
        </div>
    </template>
    <script src="js/vue.js"></script>
</body>
<script>
    var footerItem = {
        template: "#footerItem",
        props: ["name"]
    }
    var footer = {
        template: "#footer",
        data() {
            return {
                items: [
                    { title: '首页', icon: 'images/nav-icon-home.png' },
                    { title: '商品分类', icon: 'images/nav-icon-category.png' },
                    { title: '购物车', icon: 'images/nav-icon-cart.png' },
                    { title: '个人中心', icon: 'images/nav-icon-user.png' }
                ]
            }
        },
        components: {
            "FooterItem": footerItem
        }
    }
    new Vue({
        el: "#app",
        components: {
            "MyFooter": footer
        }
    })
</script>

</html>